//对象属性求和
var result = [
    {
        subject: 'math',
        score: 10
    },
    {
        subject: 'chinese',
        score: 20
    },
    {
        subject: 'english',
        score: 30
    }
];

var sum = result.reduce(function(prev, cur) {
    return cur.score + prev;
}, 0);
console.log(sum) //60
let obj=[{"name":"zs",age:20},{"name":"hh",age:10},{"name":"xx",age:30}];
let Obj=obj.reduce((prev,cur)=>{
    return prev+cur.age
},0)
console.log(Obj)//60